package com.heima.comment.controller;

import com.heima.comment.dto.CommentRepayDto;
import com.heima.comment.dto.CommentRepayLikeDto;
import com.heima.comment.dto.CommentRepaySaveDto;
import com.heima.comment.service.ICommentRepayService;
import com.heima.comment.service.ICommentService;
import com.heima.common.dto.ResponseResult;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Mr_Su
 * @version v1.0
 * @date 2022/7/6 23:42
 * @desciption
 */
@RestController
@RequestMapping("/api/v1/comment_repay")
public class CommentRepayController {

    @Autowired
    private ICommentRepayService commentRepayService;

    @PostMapping("/save")
    @ApiOperation(value = "save",notes = "保存评论回复")
    @ApiModelProperty(name = "dto",dataType = "CommentRepaySaveDto",required = true)
    public ResponseResult save(@RequestBody CommentRepaySaveDto dto){
        return commentRepayService.save(dto);
    }

    @PostMapping("/load")
    @ApiOperation(value = "load",notes = "展示评论回复列表")
    @ApiModelProperty(name = "dto",dataType = "CommentRepayDto",required = true)
    public ResponseResult load(@RequestBody CommentRepayDto dto){
        return commentRepayService.load(dto);
    }

    @PostMapping("/like")
    @ApiOperation(value = "like",notes = "点赞某条回复")
    @ApiModelProperty(name = "dto",dataType = "CommentRepayLikeDto",required = true)
    public ResponseResult like(@RequestBody CommentRepayLikeDto dto){
        return commentRepayService.like(dto);
    }
}
